Column

Order and days since prior order

x <- list(
  title = "Days since prior order"
)

y <- list(
  title = "Items in an order"
)


instacart %>% 
  group_by(order_id) %>% 
  mutate(
    num_per_order = n(),
    text_label=str_c("Days:", days_since_prior_order, "\nItems in an order:", num_per_order)) %>% 
  distinct(order_id, num_per_order, days_since_prior_order, text_label) %>% 
  plot_ly(
    x = ~days_since_prior_order, y = ~num_per_order, text = ~text_label,
    type = "violin", colors = "viridis") %>% 
   layout(xaxis = x, yaxis = y)
## Warning: `arrange_()` is deprecated as of dplyr 0.7.0.
## Please use `arrange()` instead.
## See vignette('programming') for more help
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_warnings()` to see where this warning was generated.

Column

Time in a day for each department order

y <- list(
  title = "Hour of a day"
)

instacart %>% 
  plot_ly(x = ~department, y = ~order_hour_of_day, type = "box") %>% 
  layout(yaxis = y)